/**
 * Copyright (C) 2013-2014 the original author or authors.
 */
package com.foreveross.bsl.mam.app.application;

import java.util.List;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

import com.foreveross.bsl.mam.app.application.vo.AppVersionWidgetVersionVo;

/**
 * 
 * @author tanzhixiong
 * @2013-6-21 @上午11:26:02
 */
@Path(value = "/appwidgets")
public interface AppVersionWidgetVersionApplication {

	@POST
	@Path("/relations")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public List<AppVersionWidgetVersionVo> saveEntities(List<AppVersionWidgetVersionVo> entities);

	@PUT
	@Path("/relations")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public AppVersionWidgetVersionVo updateEntity(
			AppVersionWidgetVersionVo entity);

	@DELETE
	@Path("/relations/{id}")
	public void deleteEntity(@PathParam("id") String id);

	@GET
	@Path("/relations/{id}")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public AppVersionWidgetVersionVo getEntity(@PathParam("id") String id);

	@GET
	@Path("/relations/{platform}/{version}")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public List<AppVersionWidgetVersionVo> getListByPlatEntity(
			@PathParam("platform") String platform,
			@PathParam("version") String version,
			@QueryParam("appId") String appId);

	@GET
	@Path("/widget/{wversion}/{widgetId}")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public List<AppVersionWidgetVersionVo> getListByWidget(
			@PathParam("widgetId") String widgetId,
			@PathParam("wversion") String version);

	@GET
	@Path("/appwidget")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public AppVersionWidgetVersionVo getAppWidgetEntity(
			@QueryParam("appId") String appId,
			@QueryParam("platform") String platform,
			@QueryParam("version") String version,
			@QueryParam("widgetId") String widgetId);

	@DELETE
	@Path("/widgetVerison")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public void deleteWidget(@QueryParam("widgetId") String widgetId,
			@QueryParam("version") String version);

	@DELETE
	@Path("/deleteByApp/{appId}")
	public void deleteByApp(@PathParam("appId") String appId);

	@DELETE
	@Path("/relations/{platform}/{version}")
	public void deleteByAppVersion(@PathParam("platform") String platform,
			@PathParam("version") String version,
			@QueryParam("appId") String appId);

	@DELETE
	@Path("/widget/{version}/{appId}")
	public void deleteByWidgetRelation(@PathParam("version") String version,
			@PathParam("appId") String appId);

	@POST
	@Path("/relations/delete")
	@Consumes({ MediaType.APPLICATION_JSON })
	public void deleteEntities(List<AppVersionWidgetVersionVo> entities);

	@DELETE
	@Path("/delrelations/{platform}/{appVersion}/{appId}/{widgetVersion}/{widgetId}")
	public void delByVersion(@PathParam("platform") String platform,
			@PathParam("appVersion") String appVersion,
			@PathParam("appId") String appId,
			@PathParam("widgetVersion") String widgetVersion,
			@PathParam("widgetId") String widgetId);
}
